import axiosInstance from '@/tools/request'
import type { SysMenu } from '@/api/sysMenu/sysMenu.d' // 这里时你将 sys_menu.d.ts 存放的位置

//sysMenuAdd 系统菜单添加
export const sysMenuAdd = (sysMenu: SysMenu) => {
  return axiosInstance({
    url: `/sysMenu`,
    method: 'post',
    data: sysMenu
  })
}

//sysMenuRemove 系统菜单删除
export const sysMenuRemove = (sysMenuId: number) => {
  return axiosInstance({
    url: `/sysMenu/${ sysMenuId }`,
    method: 'delete'
  })
}

//sysMenuModify 系统菜单修改
export const sysMenuModify = (sysMenu: SysMenu) => {
  return axiosInstance({
    url: `/sysMenu`,
    method: 'put',
    data: sysMenu
  })
}

//sysMenuList 系统菜单列表
export const sysMenuList = (sysMenu:SysMenu, params: any) => {
  return axiosInstance({
    url: '/sysMenu/list',
    method: 'post',
    params: params,
    data: sysMenu
  })
}

//sysMenuById 系统菜单查询通过ID
export const sysMenuById = (sysMenuId: number) => {
  return axiosInstance({
    url: `/sysMenu/${ sysMenuId }`,
    method: 'get'
  })
}

//sysMenuRemoveBatch 系统菜单删除系统缓存
export const sysMenuRemoveBatch = (ids: any[]) => {
  return axiosInstance({
    url: `/sysMenu/batchDelete`,
    method: 'delete',
    params: {
      ids:ids
    }
  })
}
